#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.common.bean.vo;

import ${package}.common.bean.po.DataTree;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.io.Serializable;
import java.util.List;

/**
 * Description: Code po
 *
 * @author wenxiaopeng
 * @date 2020/07/24 14:00
 *
 * <pre>
 *              ${copyright}
 *      Copyright (c) 2019. All Rights Reserved.
 * </pre>
 */
@Data
@Builder
@AllArgsConstructor
@ApiModel(description = "Api用代码视图")
public class CodeApiVo implements DataTree<CodeApiVo>, Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 代码id
	 */
	@JSONField(serialize = false)
	private transient Long id;

	@ApiModelProperty(value = "代码ID")
	private String code;

	@ApiModelProperty(value = "业务代码")
	private String aka;

	@ApiModelProperty(value = "代码含义")
	private String value;
	/**
	 * 上级代码id
	 */
	@JSONField(serialize = false)
	private transient Long upperCodeId;

	@ApiModelProperty(value = "代码顺序")
	private Integer order;

	@ApiModelProperty(value = "代码是否启用")
	private boolean enable;

	@ApiModelProperty(value = "下级代码")
	private List<CodeApiVo> codes;

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}

		if (o == null || getClass() != o.getClass()) {
			return false;
		}

		CodeApiVo code1 = (CodeApiVo) o;

		return new EqualsBuilder()
				.append(code, code1.code)
				.isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(17, 37)
				.append(code)
				.toHashCode();
	}

	/**
	 * Description:
	 * <获得父级id>
	 *
	 * @return java.lang.Long
	 * @author YL
	 * @date 16:06 2019/8/8
	 **/
	@Override
	@JSONField(serialize = false)
	public Long getParentId() {
		return upperCodeId;
	}

	/**
	 * Description:
	 * <获得子列表>
	 *
	 * @param childList 1
	 * @author YL
	 * @date 16:08 2019/8/8
	 **/
	@Override
	public void setChildList(List<CodeApiVo> childList) {
		this.codes = childList;
	}

	@Override
	@JSONField(serialize = false)
	public List<CodeApiVo> getChildList() {
		return this.codes;
	}
}
